﻿//using System.Reactive.Linq;
//using XmppDotNet;
//using XmppDotNet.Extensions.Client.Message;
//using XmppDotNet.Extensions.Client.Presence;
//using XmppDotNet.Extensions.Client.Roster;
//using XmppDotNet.Transport;
//using XmppDotNet.Transport.Socket;
//using XmppDotNet.Xmpp;

//namespace XmppConsoleTest
//{
//    internal class Program
//    {
//        static async Task Main(string[] args)
//        {
//            // setup XmppClient with some properties
//            var xmppClient = new XmppClient(
//                    conf =>
//                    {
//                        conf.UseSocketTransport(new StaticNameResolver(new Uri("tcp://139.224.234.161:5222")))
//                        .WithCertificateValidator(new AlwaysAcceptCertificateValidator());
//                        //conf.UseWebSocketTransport();
//                        //conf.AutoReconnect = true;

//                        // when your server dow not support SRV records or
//                        // XEP-0156 Discovering Alternative XMPP Connection Methods
//                        // then you need to supply host and port for the connection as well.
//                        // See docs => Host disconvery
//                    }
//                )
//            {
//                Jid = "jxh@iZ1dmx6k41t87iZ",
//                Password = "hilink123456"
//            };

//            // subscribe to the Binded session state
//            var test = xmppClient.StateChanged.ToList();
//            xmppClient
//                .StateChanged
//                .Where(s => s == SessionState.Binded)
//                .Subscribe(async v =>
//                {
//                    // request roster (contact list).
//                    // This is optional, but most chat clients do this on startup
//                    var roster = await xmppClient.RequestRosterAsync();

//                    // send our online presence to the server
//                    await xmppClient.SendPresenceAsync(Show.Chat, "free for chat");

//                    // send a chat message to user2
//                    await xmppClient.SendChatMessageAsync("lsj@iZ1dmx6k41t87iZ", "干掉大黑");
//                });

//            // connect so the server
//            await xmppClient.ConnectAsync();

//            // wait for a key press
//            Console.ReadLine();

//            // Close connection again
//            await xmppClient.DisconnectAsync();

//            Console.WriteLine("Hello, World!");
//        }
//    }
//}
